package entity

import (
	"gorm.io/gorm"
	"path/filepath"
	"server/application/db/schema/dbops"
	"time"
)

// SysRole 角色表
type SysRole struct {
	ID          uint `gorm:"primarykey"`
	CreatedAt   time.Time
	UpdatedAt   time.Time
	DeletedAt   gorm.DeletedAt `gorm:"index"`
	Name        string         `gorm:"column:name;comment:角色名称"`
	Sort        uint           `gorm:"column:sort;type:INT4;comment:排序"`
	Description string         `gorm:"column:description;comment:角色描述"`
	ParentId    uint           `gorm:"column:parent_id;comment:父级ID"`
}

// GenConfig 生成相关配置
func (u SysRole) GenConfig() dbops.EntityConfig {
	return dbops.EntityConfig{
		Title:             "角色",
		AsName:            "",                      //实体别名，请使用大驼峰命名法
		ViewsFatherFolder: filepath.Join("system"), //视图父目录
	}
}
